<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of RenderGroup
 *
 * @author Marcin
 */
class Zend_View_Helper_RenderGroup extends Zend_View_Helper_Abstract{
    
    public function renderGroup(Application_Model_Group $group,$options = null) {
        
        $config = array();
        $config['editable'] = true;
        
        if(!empty($options)) {
            foreach ($options as $key => $value) {
                $config[$key] = $value; 
            }
        }
        
        echo $this->view->partial('partials/_groupString.phtml',  array(
            'group' => $group)
        ); 
            
        foreach ($group->getOffers() as $offer){
            echo '<div id="offer'.$offer->getOffer_id().'" class="nested vpad_10" style="background: white" >';
            $this->view->RenderOffer($offer,$options);
            echo '</div><br/>';
        }
        
        if($config['editable']) {
            echo $this->view->partial('partials/_groupEdit.phtml',  array(
            'id' => $group->getGroup_id())
        ); 
        }
        
    }
}
?>
